<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <div v-if="res">真</div>
      <div v-else>假</div>
      <hr>
      <div v-show="res">show 真</div>
      <div v-show="!res">show 假</div>

      <hr>
      <button @click="res=!res">click me</button>
    </div>

    <script src="../js/vue.js"></script>

    <script>

      //v-if是真正的条件渲染,因为他会把条件内的事件监听器和子组件适当的销毁和重建
      //v-show不管初始条件是什么,元素总会被渲染,并且只是简单的基于css来进行切换
      //如果需要频繁的切换,v-show比较好
      const app = Vue.createApp({
        data() {
          return {
            res: true
          }
        }
      }).mount("#app");
    </script>
  </body>
</html>